#!/usr/bin/php
<?php
/**
 * DolphinGTK - phpGtk framework
 *
 * @package    DolphinGTK
 * @author     Askarov Ruslan
 * @copyright  Askarov Ruslan (c) 2010.
 * @link       http://groups.google.com/group/dolphingtk
 * @license    http://www.opensource.org/licenses/gpl-license.php GPL
 * @version    0.1
 * @since      PHP v.: 5.2.1
 * @subpackage desktop
 * @category   console
 * @filesource
 */

/*
 * Простой консольный пример использования класса клиент-сервер.
 */
define('BASE_DIR', rtrim(str_replace('\\', '/', dirname(__FILE__)), '/'). '/');
include BASE_DIR . 'library/functions.php';

load('connector');

$mail_server = '';
$mail_user = '';
$mail_pass = '';

$connector = new Connector;

if( $connector->connect($mail_server, 110) )
{
  $banner = $connector->get();

  if( substr($banner, 1, 2) == 'OK' )
  {
    $connector->set("USER $mail_user");

    if( substr($connector->get(), 1, 2) == 'OK' )
    {
      $connector->set("PASS $mail_pass");

      if( substr($connector->get(), 1, 2) == 'OK' )
      {
        $connector->set('LIST');
        print "Lines:\n";
        print $connector->lines()."\n";
      }
      else
      {
        print "Error password.\n";
      }
    }
    else
    {
      print "Error login.\n";
    }
  }
  else
  {
    print "Connection error!\n";
  }
  
  $connector->disconnect();
}
else
{
  print "Connection failure!\n";
}
?>